/**
 * created by 江心才子, 2019/8/29
 * Copyright (c) 2019, 270628297@qq.com All Rights Reserved.
 * #                   *********                            #
 * #                  ************                          #
 * #                  *************                         #
 * #                 **  ***********                        #
 * #                ***  ****** *****                       #
 * #                *** *******   ****                      #
 * #               ***  ********** ****                     #
 * #              ****  *********** ****                    #
 * #            *****   ***********  *****                  #
 * #           ******   *** ********   *****                #
 * #           *****   ***   ********   ******              #
 * #          ******   ***  ***********   ******            #
 * #         ******   **** **************  ******           #
 * #        *******  ********************* *******          #
 * #        *******  ******************************         #
 * #       *******  ****** ***************** *******        #
 * #       *******  ****** ****** *********   ******        #
 * #       *******    **  ******   ******     ******        #
 * #       *******        ******    *****     *****         #
 * #        ******        *****     *****     ****          #
 * #         *****        ****      *****     ***           #
 * #          *****       ***        ***      *             #
 * #            **       ****        ****                   #
 */
package com.wyl.mine.unique.assets

import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import com.wuhenzhizao.titlebar.widget.CommonTitleBar
import com.wyl.base.databinding.CommonListActivityBinding
import com.wyl.libbase.base.BindingActivity
import com.wyl.libbase.binding.recyclerview.RecyclerViewDivider
import com.wyl.mine.R
import io.ditclear.bindingadapter.SingleTypeAdapter
import org.koin.android.viewmodel.ext.android.viewModel

/**
 * 项目名称：O2o
 * 创建人：江心才子
 * 创建时间：2019-08-29 10:11
 * 内容描述：
 * 修改说明：
 */

class MedalActivity : BindingActivity<CommonListActivityBinding>() {
    private val viewModel by viewModel<MedalViewModel>()

    override fun getLayoutId(): Int = R.layout.common_list_activity

    override fun loadData() {
        binding.include.refreshLayout.startRefresh()
    }

    override fun initView() {
        binding.vm = viewModel

        binding.titleBar.apply {
            centerTextView.text = "获奖"
            setListener { _, action, _ ->
                when (action) {
                    CommonTitleBar.ACTION_LEFT_BUTTON -> onBackPressed()
                    else -> {
                    }
                }
            }
        }

        binding.ad.visibility = View.GONE

        binding.include.recyclerView.apply {
            layoutManager = LinearLayoutManager(context)
            adapter = mAdapter
            addItemDecoration(RecyclerViewDivider(context, RecyclerViewDivider.VERTICAL))
        }
    }

    private val mAdapter by lazy {
        SingleTypeAdapter(this, R.layout.medal_item, viewModel.dataSource)
            .apply {
                //                itemPresenter = o
            }
    }
}
